home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac: Not for Sale / Another.not.for.sale (Australia).iso / fade into you / being there / How To & FAQ's / FAQ CSH Coke Machine Informati < prev    next >
Text File  |  1994-06-05  |  17KB  |  340 lines

  1.  
  2.           Friday, 3 June 1994 6:45:20 PM
  3.           alt.internet.services Item
  4.   From:           drink@drink.csh.rit.edu,internet
  5.   Subject:        FAQ: CSH Coke Machine Information
  6.   To:             alt.folklore.college,internet
  7.                   alt.folklore.computers
  8.                   alt.internet.services
  9.                   alt.answers,internet
  10.                   news.answers,internet
  11. Archive-name: csh-coke-machine-info
  12. Version: $Id: FAQ,v 1.2 1994/05/23 15:57:24 pat Exp pat $
  13. Posting-Frequency: monthly
  14.  
  15. Contents:
  16.     1. _A_Brief_Overview_of_The_Computer_Science_House_Coke_Machine_.
  17.     2. _The_History_Of_Our_Machine_.
  18.     3. _The_Hardware_In_The_Machine_.
  19.     4. _The_Software_On_the_Unix_Side_.
  20.     5. _The_Wide-Area_Access_Points_.
  21.     a) graph
  22.     b) xdrink
  23.     6. _Current_Plans_for_the_Drink_Machine_.
  24.  
  25.  
  26. 1. _A_Brief_Overview_of_The_Computer_Science_House_Coke_Machine_.
  27.  
  28.     The following was only slightly modified from a mail message
  29.     written by Tad Hunt (Wed, 27 Apr 1994 12:25:54 -0400)
  30.  
  31.     Our drink system is composed of several parts, the drink machine
  32.     itself, the computer inside the machine, the serial connection to
  33.     our drink server machine, the accounting software, and finally the
  34.     wide area information systems (such as finger).
  35.  
  36.     The computer inside the drink machine is very simple.  It
  37.     accepts commands to "drop" drinks from slots 1-5 (by sending
  38.     an ascii '1'-'5' from the server), and a command to query status
  39.     (an ascii 'A').  The computer drops drinks by tripping a relay to
  40.     the solenoid on the particular slot requested.  The status returned
  41.     is a bit pattern indicating if each slot is either full or empty
  42.     (full is defined as one or more cans remaining) based on sensors
  43.     in the slots.  All of this can be done through the wires that
  44.     normally interface to the buttons on the front of the machine.
  45.  
  46.     On the server machine, there is a program called "drink" which
  47.     keeps track of money in user accounts, how many cans are in each
  48.     slot, the kind of drink in each slot, and how long the drink has
  49.     been in the machine (for determining how cold it is).  This
  50.     is the only program with permission to access "/dev/drink", which
  51.     is the serial port the Coke Machine is connected to.  If the serial
  52.     port isn't locked, it locks it, then querys the status of the
  53.     machine to display a menu to the user, and allows them to choose
  54.     a drink.  If the user has enough money in their account, and the
  55.     slot isn't marked empty, the program asks for a time delay to wait
  56.     before dropping the drink (in case the user needs to walk to the
  57.     machine), then sends the command down the serial line to drop the
  58.     appropriate drink.
  59.  
  60.     Finally comes the wide area information systems.  We setup an
  61.     alias for one of our machines (satan.csh.rit.edu) to answer
  62.     requests for drink.csh.rit.edu, and rewrote the finger program to
  63.     display machine status by rsh(1)ing to the server machine and
  64.     running the drink program in a mode to query machine statistics.
  65.     Also added at this point was an XWindows drink client program,
  66.     which uses command line options to "drink" to allow users to run
  67.     an XWindows drink machine program and drop drinks by clicking a
  68.     button.  You can run this program yourself -- if you have XWindows
  69.     -- by doing the following:  "finger $DISPLAY@drink.csh.rit.edu",
  70.     it will send "xdrink" to your display.  Also, you can get a graph
  71.     of machine statistics by doing:  "finger graph@drink.csh.rit.edu"
  72.  
  73.     The drink system will soon be entering the "client-server" age
  74.     with the addition of a debit daemon written by one of the drink
  75.     support people, which will be useful for more than just drink, it's
  76.     a generic debit system.  Most if not all of this  system will soon
  77.     be available for anonymous ftp from ftp.csh.rit.edu in pub/drink.
  78.  
  79. 2. _The_History_Of_Our_Machine_.
  80.  
  81.     Somebody here at RIT threw away a Coke Machine.  It was pretty
  82.     beat up, but the members of Computer Science House plucked it from
  83.     the trash none-the-less.  The Coke Machine was cleaned up and put
  84.     to use.  It ran as a normal vending machine for some time in this
  85.     way.
  86.  
  87.     But, as the red-tape flies, the company who owns the vending
  88.     machine rights to the RIT campus complained that we were threatening
  89.     their rights.  In a wonderous swirl of politics and crazy techies
  90.     resulted in the Coke Machine being hooked up to the computer systems.
  91.     For, as you see, a 'Vending Machine' is a machine that accepts
  92.     money and gives out consumables in return.  We don't have a 'Vending
  93.     Machine' so much as a high-tech group refrigerator.  The Coke Machine
  94.     only accepts money or returns a drink.  If you're silly enough to put
  95.     money in the little slot, you've lost your money.  If you've already
  96.     given money to a drink admin, you can dispense a drink through the
  97.     computer systems.
  98.  
  99.     Not long after that, a newer Coke Machine was donated to Computer
  100.     Science House.  The first implementations of the Coke Machine were
  101.     done on a small processor on a bread-board.  The newer implementation
  102.     is a bit more 'rugged' (and explained below) in that many of the
  103.     connections are actually soldered.  8^).
  104.  
  105.     This machine has been painted the CSH colors (purple and pink a la
  106.     DEC/pdp).  It bears the Computer Science House name.  We're proud to
  107.     have it on the Internet, but we must admit that CMU beat us to the
  108.     punch.  Our big advantage over their machine though is the ability
  109.     to drop a drink from where you sit and have it arrive at the same
  110.     time you get to the machine.  Our machine has been the subject of
  111.     little blurbs in major publications across the country and is listed
  112.     as the 7th-most-fingered site by Wired magazine.  And, the current
  113.     record for long-distance drops is Arizona to Rochester.
  114.  
  115. 3. _The_Hardware_In_The_Machine_.
  116.  
  117.     The computer in the machine is a small 8051 board with a serial
  118.     connection, LCD display, A/D convertor, and several out ports.  The
  119.     EPROM that this board runs from contains code written by Sean
  120.     McGranaghan.  That code is loosely based on code written by Frank
  121.     Giuffrida for that board's intended purpose as power-supply monitor
  122.     and regulator.
  123.  
  124.     As is mentioned above, this software simply reads the status
  125.     lines that were at one time hooked up to the LED indicators on the
  126.     buttons of the machine to check the fullness of a slot.  In its
  127.     current incarnation, the sensor on the Jolt slot tends to stick
  128.     in the 'Empty' position.  Fortunately for us caffeine mongers, the
  129.     'Empty' indicator can be ignored.
  130.  
  131.     If a request for status is received on the serial line, a bit
  132.     mask is formed indicating which slots are full.  This bit mask is
  133.     sent back over the serial line to the waiting program that made
  134.     the request.  In this mask, the bits 0 through 4 are used to
  135.     represent the 5 slots on the machine.  The 5th bit is also set to
  136.     ensure that the return value is a printable ascii character and as
  137.     a verification that it actually did check the slots.
  138.  
  139.     If an ascii digit on the range '1' - '5' is sent to this board,
  140.     it triggers a solid-state relay which closes the circuit that would
  141.     normally be closed by pressing the button on the front of the machine.
  142.     If this is successful, a 'D' is transmitted back to the waiting
  143.     program.  If this fails, an 'E' is sent back to the waiting program.
  144.     ('D' is for drop.  'E' is for error.)
  145.  
  146.     The LCD on the board constantly displays a message
  147.     'CSH Coke Machine' and the amount of time since the board
  148.     has been reset in the form 'Day 000 00:00:00'.
  149.  
  150.     Currently, several schemes are being considered for this board to
  151.     verify that it is talking to some program and not to someone with
  152.     tip(1) access to the device.  This will make the Coke Machine no more
  153.     vulnerable to root attack than user attack.
  154.  
  155. 4. _The_Software_On_the_Unix_Side_.
  156.     
  157.     The board in the Coke Machine is connected to a CCI Power 6/32
  158.     Tahoe that is currently running BSD 4.3 Shanzer (a custom blend
  159.     of 4.3 Reno, 4.3 Tahoe, and 4.4 Alpha).  /dev/drink is configured
  160.     as a 9600-baud connection to the board in the Coke Machine.  The
  161.     connection is over a standard RS232 connection.
  162.  
  163.     The software consists, currently, of one main program called
  164.     'drink'.  drink(1) maintains a database of user balances and
  165.     statistics as well as slot statistics.  This software has undergone
  166.     many revisions (read: total rewrites) over the years.  I'm pretty
  167.     sure that I'm the only one who will admit to having touched it.
  168.     But, I'll drag in Bob Krzaczek's name into it to as the last person
  169.     to touch the stuff I hacked on.
  170.  
  171.     In its current incarnation, this software keeps track of
  172.     user balances in CSH-franks.  These bear a striking relation
  173.     to US-dollars in that the exchange rate has always been 100
  174.     CSH-franks to 1 U.S. Dollar.  But, such relationships are
  175.     human constructions and probably just coincidences that reflect
  176.     deep underlying symmetries in the web of the Universe (or not)
  177.     [much like the way RIT student ids resemble, but are distinct from,
  178.     social security numbers].  CSH-franks are known by some as
  179.     CSHmids and CSH-wonder-wubbas.  But... the last 6 minutes of
  180.     voting turned up 2 votes for CSH-franks, 1.5 votes for CSH-bobas,
  181.     several incoherent mumbles about Pink Floyd, a compromise for
  182.     CSH-verypinkmetaloidoncebelongedtofrankthenBOBAwonderwubbamids,
  183.     and not much else in the close-to-relevant category.  [If Ross
  184.     Perot was ever part of a CSH wall(1) war, he'd think twice about
  185.     electronic town-meetings.]
  186.  
  187.     The drink(1) program offers several command line options.  These
  188.     are:
  189.     -o [12345rg]    where a number specifies a slot to drop a drink
  190.             from, 'r' specifies to drop a drink from a random
  191.             slot (choosing from the full-ones), and 'g' is
  192.             a special gamble option (to be described later).
  193.  
  194.     -d N        delays for N seconds before dropping the drink.
  195.  
  196.     -l login    useful for dropping a drink from the balance
  197.             of the user given by 'login'.  This option
  198.             prompts you for a password to validate you.
  199.  
  200.     -m        forces menu mode where the current slot statistics
  201.             are displayed.
  202.     
  203.     -b        shows the user's balance.
  204.  
  205.     -s        shows the user's raw statistics as number of
  206.             drinks dropped per slot.
  207.  
  208.     -S        shows the user's statistics in relation to the
  209.             global statistics.  This options shows number
  210.             of drinks dropped by the user on a per-slot basis
  211.             and the number of drinks dropped overall on
  212.             a per-slot basis and the percentage per-slot
  213.             the user makes up.  For example, for me, now,
  214.             I have dropped 382 of 2412 drinks dropped from
  215.             slot 5 since last time the statistics were
  216.             cleared.  I account for 15.8375 percent of the
  217.             drops from slot 5 (Coke Classic).  Also given
  218.             in these statistics is the current gamble cost
  219.             and the accumulated gamble (to be explained later).
  220.  
  221.     -t        shows the number of drinks in each slot divided
  222.             into time slots.  Along the vertical, each slot
  223.             is shown.  Across the horizontal, the number
  224.             of drinks in the slot for less than one hour,
  225.             between one and three hours, more than
  226.             three hours, and the total in the slot is shown.
  227.  
  228.     -T        This option is similar to the last but it puts
  229.             out the information in a form easily readable by
  230.             other programs.  First, it puts out the current
  231.             time as returned by time(2).  Then, it puts out
  232.             on the following the title of the first slot and
  233.             a string representing how many drinks are in the
  234.             slot and what times they were placed there.  This
  235.             string is of the form:
  236.                 number time number time number time 0
  237.             All time(2) values are printed in hexidecimal.
  238.             These couplets are repeated for each slot.
  239.  
  240.     The gamble option was originally designed to make use of the
  241.     fact that the drink machine isn't always full and the fact that people
  242.     may not have enough of a balance to afford a drink.  With the gamble
  243.     option, the cost of gambling is computed by adding up the prices of
  244.     all of the full slots, dividing by the total number of slots and adding
  245.     the 'gamble cost'.  The 'gamble cost' is currently 2 CSH-franks.
  246.     This is a fudge-factor to favor drink staying in the black.  The more
  247.     slots that are empty, the lower the cost.  The current risk is 12
  248.     CSH-franks, but the odds of getting a drink are only 1 in 5
  249.     (and that slot is the Diet Mystery Slot (a double whammee)).  A side
  250.     goal is to integrate a 'Coke' as a potion in some deep dungeon in
  251.     nethack and, if you quaff it, and the accumulated gamble cost is
  252.     greater than than the price of a Coke, it'll drop you one.  The current
  253.     accumulated gamble cost is 262 CSH-franks.
  254.  
  255. 5. _The_Wide-Area_Software_.
  256.  
  257.     If you have finger(1) access, X access, or Mosaic(1) access, you
  258.     can witness our Coke Machine first-hand from where you sit.  There
  259.     are two main pathways to our Coke Machine through the Internet.  These
  260.     are through Tad Hunt's modified finger(1) @drink.csh.rit.edu and
  261.     through Eric Van Hensbergen's xdrink(1) interface.  Both of these
  262.     can be accessed from the CSH Drink Machine page on the World Wide
  263.     Web.  The URL for that page is:
  264.  
  265.     http://www.csh.rit.edu/proj/drink.html
  266.     
  267. 5a) graph
  268.     One of the first bits of net access we allowed to our Coke
  269.     Machine was to finger(1) it to get information.  The current state
  270.     of the Coke Machine can be divined in several ways through finger(1).
  271.     Tad Hunt rewrote the finger(1) program at drink.csh.rit.edu to
  272.     handle several virtual users.  The first of these can be accessed
  273.     by fingering graph@drink.csh.rit.edu.  This will display an
  274.     informational message and an ascii representation of the Coke Machine.
  275.     This representation includes the price at each slot, the number of
  276.     drinks in each slot, and a graph representing the coldness of those
  277.     drinks.  Emprical tests have shown that complete coldness of a drink
  278.     is achieved in three hours.
  279.  
  280.     A different view of the contents of the coke machine can be
  281.     obtained by fingering drink@drink.csh.rit.edu.  There is a great
  282.     deal of redundant information in this, but.... what can you do?
  283.  
  284.     Fingering info@drink.csh.rit.edu will provide more information
  285.     into the ways to finger the coke machine.
  286.  
  287.     And, if you're running X-windows, a command like
  288.     'finger mymachine.mynet.myorg:0.0@drink.csh.rit.edu` or
  289.     'finger ${DISPLAY}@drink.csh.rit.edu' should bring up an X-interface
  290.     to our drink software on your display.
  291.  
  292. b) xdrink
  293.  
  294.     The xdrink(1) interface was written by Eric Van Hensbergen.
  295.     It presents bitmaps for each of the slots (they easily get out
  296.     of date (sorry)).  It offers a pointy-clicky interface for those
  297.     not too keen on command lines.  It represents the fullness of
  298.     each slot with a bar-graph, the contents with a bitmap, and the
  299.     mystery-slot as a flashing pattern of the bitmaps.
  300.  
  301. 6. _Current_Plans_for_the_Drink_Machine_.
  302.  
  303.     I am currently almost finished with a new incarnation of the
  304.     drink software.  This incarnation involves a 'telnet' interface
  305.     similar to those of 'smtp' and 'ftp'.  It also provides a means
  306.     for kerberos authentication.  Additionally, it will talk several
  307.     languages from English to German to Esperanto to Lojban to Rot13
  308.     (English) to Piglatin (English).  More on this as it's available.
  309.     Also, in this incarnation, one will be able to risk any amount of
  310.     money above the gamble cost, choosing their desired slot, and having
  311.     odds proportional to the amount risked divided by the cost of the
  312.     desired drink.
  313.  
  314. For more further questions or to arrange a personal tour of Computer Science
  315. House, mail drink@drink.csh.rit.edu.
  316. -- 
  317.     "Toured the world in a heavy metal band/
  318.      but they've run out of gas/
  319.      the plane can never land"
  320.  
  321. ----Internet Header Follows----
  322. Newsgroups: alt.folklore.college,alt.folklore.computers,alt.internet.services,alt.answers,news.answers
  323. Path: macconn!inferno.mpx.com.au!metro!news.cs.su.oz.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!news.duke.edu!godot.cc.duq.edu!nntp.club.cc.cmu.edu!cantaloupe.srv.cs.cmu.edu!rochester!rit!isc-newsserver!nick.csh.rit.edu!pat
  324. From: drink@drink.csh.rit.edu
  325. Subject: FAQ: CSH Coke Machine Information
  326. X-Archive-Information: /pub/drink/FAQ @ ftp.csh.rit.edu
  327. Message-ID: <1994Jun3.184520.28288@ultb.isc.rit.edu>
  328. Followup-To: alt.folklore.college
  329. Summary: So I hopefully won't have to answer too many questions... 8^)
  330. Originator: pat@nick.csh.rit.edu
  331. Keywords: internet coke machine, coke machine, network coke
  332. Sender: pat@mail.csh.rit.edu
  333. Nntp-Posting-Host: nick.csh.rit.edu
  334. Reply-To: drink@drink.csh.rit.edu
  335. Organization: Computer Science House @ RIT
  336. X-Posting-Information: This article posted automagically, monthly
  337. Date: Fri, 3 Jun 1994 18:45:20 GMT
  338. Approved: news-answers-request@MIT.Edu
  339. Lines: 309
  340.